package com.midian.model.permission;

import javax.persistence.Entity;
import javax.persistence.Table;

import com.midian.common.system.SysStatic;
import com.midian.model.common.BaseModel;

/**
 * 权限细项
 * @author Mengfh
 *
 */
@Entity
@Table(name = "auth")
public class Auth extends BaseModel {
	
	private static final long serialVersionUID = -7201750472579165837L;
	/**父id*/
	private Integer parentId;
	/**模块id（模块id与名称的映射，在web容器初始化时加载）*/
	private Integer moduleId;
	/**是否操作*/
	private Integer isOp;
	/**权限key名称*/
	private String keyName;
	/**权限显示名称*/
	private String funcName;
	/**排序*/
	private Integer gradation;

	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	public Integer getModuleId() {
		return moduleId;
	}

	public void setModuleId(Integer moduleId) {
		this.moduleId = moduleId;
	}

	public Integer getIsOp() {
		return isOp;
	}

	public void setIsOp(Integer isOp) {
		this.isOp = isOp;
	}

	public String getKeyName() {
		return keyName;
	}

	public void setKeyName(String keyName) {
		this.keyName = keyName;
	}

	public String getFuncName() {
		return funcName;
	}

	public void setFuncName(String funcName) {
		this.funcName = funcName;
	}

	public Integer getGradation() {
		return gradation;
	}

	public void setGradation(Integer gradation) {
		this.gradation = gradation;
	}
	
	/**
	 * 模块名称
	 * @return
	 */
	public String getModuleName() {
		String moduleName = "";
		if(this.moduleId != null) {
			moduleName = SysStatic.MODELMAP.get(this.moduleId);
		}
		return moduleName;
	}
	
	/**
	 * 是否操作按钮描述
	 * @return
	 */
	public String getIsOpDesc() {
		String isOpDesc = "";
		if(SysStatic.AUTH_IS_OP.equals(this.isOp)) {
			isOpDesc = "是";
		} else {
			isOpDesc = "否";
		}
		return isOpDesc;
	}
}
